<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style>
		*{margin: 0;padding: 0;}
		.wrap{
			width: 190px;
			height: 260px;
			position: relative;
			background-image: url(img/bg.png);
		}
		.title{
			text-align: center;
		    font-size: 30px;
		    font-weight: 700;
		    padding-top: 31px;
		    color: #ffffff;
		}
		.miaosha-red-time{
	        position: absolute;
	        bottom: 40px;
			left: 30px;
       	}
       	.times{
	        position: relative;
	        float: left;
	        width: 30px;
	        height: 30px;
	        color: #ffffff;
	        margin-right: 20px;
	        text-align: center;
	        line-height: 30px;
	        background-color: #2f3430;
	        font-weight: bold;
	        font-size: 20px;
       	}
       	.times::after{
       		content: ":";
       		display: block;
       		position: absolute;
       		right: -15px;
       		top: 0;
       	}
       	.times:last-of-type::after{
       		content: "";
       	}
	</style>
</head>
<body>
	<div class="wrap">
		<h1 class="title">京东秒杀</h1>
		<div class="miaosha-red-time">
			<div class="times" id="s">00
			</div>
			<div class="times" id="f">00</div>
			<div class="times" id="m">00</div>
		</div>
	</div>

	<script>
	   //京东秒杀倒计时
	   function GetRTime(){
	       	//结束时间
	       	var EndTime= new Date('2019/9/6 8:39:10');
	       	//当前时间
	       	var NowTime = new Date();
	       	//剩余的时间
	       	var t =EndTime.getTime() - NowTime.getTime();

	       	//获取存放时间的div
			var h1 = document.getElementById("s");
			var s1 = document.getElementById("f");
			var m1 = document.getElementById("m");
	       	var h=Math.floor(t/1000/60/60);//剩下的时
	       	var m=Math.floor(t/1000/60%60);//剩下的分
	       	var s=Math.floor(t/1000%60);//剩下的秒
	       	h <10 ? h = '0' +h :h =h;
	       	m <10 ? m = '0' +m :m =m;
	       	s <10 ? s = '0' +s :s =s;
	       	h1.innerHTML=h;
	       	s1.innerHTML=m;
	       	m1.innerHTML=s;
	       	if(t<=0){
		       	h1.innerHTML="结";
		       	s1.innerHTML="束";
		       	m1.innerHTML="了";
		       	clearInterval(tim);
		    }
	   	}
	   	GetRTime()
	   	var tim = setInterval(GetRTime,1000);
	</script>
</body>
</html>